<?php
global $base_path;
$added_query = array();
foreach ($_GET as $k=>$v){
  if($k != 'q'){
    $added_query[$k] = $v;
  }
}
if ($links): ?>
	<select name="language-switcher" class="form-select" onchange="window.location=jQuery(this).val();">
	<?php foreach ($links as $key=> $link): ?>
	<option id="<?php print $key;?>"  value="<?php
    $link['query'] = $added_query;
    $url = url((isset($link['href'])? $link['href']: ''),$link);
    $url = (($url == $base_path.$key)? $url.'/welcome' : $url);
	print $url;?>"  
	   <?php global $language; if($language->language == $key): ?> 
			selected
	   <?php endif; ?>
	 >
		<?php print $link['title'];?>
	</option>
	<?php endforeach; ?>
	</select>
<?php endif; ?>
